import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/* 库存管理 新增 入库操作 */
export const add = (row) => {
  return request({
    url: '/api/rb-oem/oem/store/store/inStorage',
    method: 'post',
    data: row
  })
}

/* 库存管理 调拨操作 */
export const allotStorage = (row) => {
  return request({
    url: '/api/rb-oem/oem/store/store/trStorage',
    method: 'post',
    data: row
  })
}

/* 库存管理 回拨操作 */
export const rebateStorage = (row) => {
  return request({
    url: '/api/rb-oem/oem/store/store/trStorageNo',
    method: 'post',
    data: row
  })
}

/* 库存管理 查询 sn关联匹配设备信息 */
export const queryModelByStore = (params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/queryModelByStore',
    method: 'get',
    params: {
      ...params
    }
  })
}

/* 库存管理 查询 验证入库列表 */
export const queryStoreList = (params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/queryStoreList',
    method: 'get',
    params: {
      ...params
    }
  })
}

/* 库存管理 查询 验证调拨列表 */
export const queryTrList = (params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/queryTrListPlus',
    method: 'get',
    params: {
      ...params
    }
  })
}

/* 库存管理 查询 验证调拨列表 */
export const queryRbList = (params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/queryTrListPlusNo',
    method: 'get',
    params: {
      ...params
    }
  })
}



/* 库存管理 查询 设备类型列表 */
export const selectTypeList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/selectTypeList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/* 库存管理 查询 设备品牌(供应商)列表 */
export const selectSupList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/selectSupList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/* 库存管理 查询 设备型号列表 */
export const selectModelList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/selectModelList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

// // 详情--自带
// export const getDetail = (id) => {
//   return request({
//     url: '/api/rb-oem/oem/store/store/detail',
//     method: 'get',
//     params: {
//       id
//     }
//   })
// }

// 删除--自带
export const remove = (ids) => {
  return request({
    url: '/api/rb-oem/oem/store/store/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
// // 更新--自带
// export const update = (row) => {
//   return request({
//     url: '/api/rb-oem/oem/store/store/submit',
//     method: 'post',
//     data: row
//   })
// }

/* 仓库 导出 */
export const getExport = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/store/store/export',
    method: 'get',
    params: {
      ...params,
    }
  })
}

/* 仓库 导出模板 */
export const getExportTemplate = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/store/store/export-template',
    method: 'get',
    params: {
      ...params,
    }
  })
}
/* 仓库 导出模板 智能POS、传统POS*/
export const getExportTemplatePos = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/store/store/export-template-pos',
    method: 'get',
    params: {
      ...params,
    }
  })
}

/* 库存管理 查询通道列表 */
export const getSelectAisleList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/selectAisleList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

/* 库存管理 查询 设备型号列表 */
export const queryMerchantRenewMoney = (rsSn) => {
  return request({
    url: '/api/rb-oem/oem/store/store/queryMerchantRenewMoney',
    method: 'get',
    params: {
      rsSn
    }
  })
}

/* 批量入库 */
export const uploadFile = (file, type,userNo) => {
  const formData = new FormData();
  formData.append('file', file);
  formData.append('type', type);
  formData.append('userNo', userNo);
  return request({
    headers: {
      "Content-Type": "multipart/form-data"
    },
    url: '/api/rb-oem/oem/store/store/import',
    method: 'post',
    data: formData
  })
}

/* 划拨批量入库 */
export const uploadFileTr = (file, type,inNo) => {
  const formData = new FormData();
  formData.append('file', file);
  formData.append('type', type);
  formData.append('inNo', inNo);
  return request({
    headers: {
      "Content-Type": "multipart/form-data"
    },
    url: '/api/rb-oem/oem/store/store/importTr',
    method: 'post',
    data: formData
  })
}

/* 回拨批量入库 */
export const uploadFileTrNo = (file, type) => {
  const formData = new FormData();
  formData.append('file', file);
  formData.append('type', type);
  // formData.append('inNo', inNo);
  return request({
    headers: {
      "Content-Type": "multipart/form-data"
    },
    url: '/api/rb-oem/oem/store/store/importTrNo',
    method: 'post',
    data: formData
  })
}

/* 盛付通 pos 获取最低费率 */
export const minPolicy = (aisleCode,sn) => {
  return request({
    url: '/api/rb-oem/oem/store/store/getLoginUserMinSettleRate',
    method: 'get',
    params: {
      aisleCode,
      sn
    }
  })
}

// 机器费率 POS 提交
export const submitPolicy = (params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/initSetSnRate',
    method: 'post',
    data:{...params}
  })
}


/* 机器费率管理 列表 */
export const apiTongDao = () => {
  return request({
    url: '/api/rb-oem/oem/store/store/queryInitRateSupList',
    method: 'get'
  })
}

/* 传统POS 导出-下载中心 */
export const getPosExport = (params) => {
  return request({
    url: '/api/rb-oem/oem/store/store/exportStore',
    method: 'get',
    params: {
      ...params
    }
  })
}